const arr = [1, 2, 3, 2, 4];

for (let i = 0; i < arr.length; i++) {
  if (arr[i] == 2) {
    continue; // 跳过本次循环
  }
  console.log(arr[i]);
}

// forEach 遍历数组
arr.forEach(function (elem, index, array) {
  console.log(elem, index);
});
